<?php
	$base_url = base_url() . "product/product-for-sale/?filter=true";       
	if (!empty($_GET['offset'])) {
	       $offset = "&offset=".$_GET['offset'];
	} else {
	       $offset = "&offset=0";
	 }
?>
<div class="mens">    
  <div class="main">
     <div class="wrap">
		<div class="cont span_2_of_3">
		  	<h2 class="head">List product for buy</h2>
		  	<div class="mens-toolbar">
              <div class="sort">
               	<div class="sort-by">
		            <label>Sort By</label>
		            <select onchange="location=this.value">
		            				<?php
		            					if(isset($_GET['limit']) && $_GET['limit']!=""){
		            						$limit="&limit=".$_GET['limit'];
		            					}else{
		            						$limit="";
		            					}
		            				?>
		                            <option value="<?php echo $base_url;?>&sort=sort_order&order=ASC<?php echo $limit;?><?php echo $offset;?>">Default</option>
		                            <option value="<?php echo $base_url;?>&sort=name&order=ASC<?php echo $limit;?><?php echo $offset;?>">Name (A-Z)</option>
		                            <option value="<?php echo $base_url;?>&sort=name&order=DESC<?php echo $limit;?><?php echo $offset;?>">Name (Z-A)</option>
		                            <option value="<?php echo $base_url;?>&sort=price&order=ASC<?php echo $limit;?><?php echo $offset;?>">Price (Low > High)</option>
		                            <option value="<?php echo $base_url;?>&sort=price&order=DESC<?php echo $limit;?><?php echo $offset;?>">Price (High > Low)</option>
		                            <option value="<?php echo $base_url;?>&sort=rating&order=ASC<?php echo $limit;?><?php echo $offset;?>">Rating (Highest)</option>
		                            <option value="<?php echo $base_url;?>&sort=rating&order=DESC<?php echo $limit;?><?php echo $offset;?>">Rating (Lowest)</option>
		            </select>
		            <a href=""><img src="<?php echo base_url().F_IMG;?>arrow2.gif" alt="" class="v-middle"></a>
               </div>
    		</div>
        <div class="pager">   
        	<div class="limiter visible-desktop">
            <label>Show</label>
            <select onchange="location=this.value">
            	<?php
		            	if((isset($_GET['sort']) && $_GET['sort']!="") && isset($_GET['order']) && $_GET['order']!=""){
		            			$sort="&sort=".$_GET['sort']."&order=".$_GET['order'];
								$limit="&limit=";
		            	}else{
		            			$sort="";
								$limit="&limit=";
		            	}
		            ?>
				<option value="<?php echo $base_url;?><?php echo $sort;?><?php echo $limit;?>15<?php echo $offset;?>">Default</option>
		        <option value="<?php echo $base_url;?><?php echo $sort;?><?php echo $limit;?>30<?php echo $offset;?>">30</option>
		        <option value="<?php echo $base_url;?><?php echo $sort;?><?php echo $limit;?>45<?php echo $offset;?>">45</option>
		        <option value="<?php echo $base_url;?><?php echo $sort;?><?php echo $limit;?>60<?php echo $offset;?>">65</option>
            </select>        
             </div>
       		<!--<ul class="dc_pagination dc_paginationA dc_paginationA06">
			    <li><a href="#" class="previous">Pages</a></li>
			    <li><a href="#">1</a></li>
			    <li><a href="#">2</a></li>
		  	</ul>-->
	   		<div class="clear"></div>
    	</div>
     	<div class="clear"></div>
	</div>
<?php
			if($products->num_rows()>0){
				$i=1;
				
				
				
					 foreach($products->result() as $row){
					    	$key_code=$row->key_code;
							$name=$row->pro_name;
							$price=$row->price;
							$desc=$row->description;
							$img=$row->img_name;
							$views=$row->view;
							if($i==1 || $i==4 || $i==7 || $i==10 || $i==13){
					
					echo '<div class="top-box">';				
				}
							
?>
			
			 <div class="col_1_of_3 span_1_of_3"> 
			   <a href="<?php echo base_url();?>product/detail/<?php echo $key_code;?>">
				<div class="inner_content clearfix">
					<div class="product_image">
						<img src="<?php echo base_url().F_IMG;?><?php echo $img;?>" alt=""/>
					</div>
                    <div class="sale-box"><span class="on_sale title_shop">New</span></div>	
                    <div class="price">
					   <div class="cart-left">
							<p class="title"><?php echo str_replace("_", " ", $name);?></p>
							<div class="price1">
							  <span class="actual"><?php echo money_format('%#10n', $price);?></span>
							  <span style="float:right;"><?php echo number_format($views);?> <?php echo ($views>1)?"views":"view";?></span>
							</div>
						</div>
						<div class="cart-right"> </div>
						<div class="clear"></div>
					 </div>				
                   </div>
                 </a>
				</div>
									
<?php
					if($i==3 || $i==6 || $i==9 || $i==12 || $i==15){
						echo '<div class="clear"></div>';
						echo '</div>';				
					}else if($i==$products->num_rows() && ($products->num_rows()%3) !=0){
						
						echo '<div class="clear"></div>';
						echo '</div>';		
					}
					
			
		
					$i++;
				}
	
		
					
		}else{
				 echo '<div class="alert alert-info">There is no product post for sale in  list</div>';
		}
?>		
		<?php echo $pagination;?>		 							 			    
		  </div>
			<div class="rsidebar span_1_of_left">
				<h5 class="m_1">Categories</h5>
					<select class="dropdown" tabindex="8" data-settings='{"wrapperClass":"metro"}'>
						<option value="1">Mens</option>
						<option value="2">Sub Category1</option>
						<option value="3">Sub Category2</option>
						<option value="4">Sub Category3</option>
					</select>
					<select class="dropdown" tabindex="8" data-settings='{"wrapperClass":"metro"}'>
						<option value="1">Womens</option>
						<option value="2">Sub Category1</option>
						<option value="3">Sub Category2</option>
						<option value="4">Sub Category3</option>
					</select>
					<ul class="kids">
						<li><a href="#">Kids</a></li>
						<li class="last"><a href="#">Glasses Shop</a></li>
					</ul>
                   <section  class="sky-form">
					<h4>Price</h4>
						<div class="row row1 scroll-pane">
							<div class="col col-4">
								<label class="checkbox"><input type="checkbox" name="checkbox" checked=""><i></i>Rs 500 - Rs 700</label>
							</div>
							<div class="col col-4">
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Rs 700 - Rs 1000</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Rs 1000 - Rs 1500</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Rs 1500 - Rs 2000</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Rs 2000 - Rs 2500</label>
								<label class="checkbox"><input type="checkbox" name="checkbox" ><i></i>Rs 2500 - Rs 3000</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Rs 3500 - Rs 4000</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Rs 4000 - Rs 4500</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Rs 4500 - Rs 5000</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Rs 5000 - Rs 5500</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Rs 5500 - Rs 6000</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Rs 6000 - Rs 6500</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Rs 6500 - Rs 7000</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Rs 7000 - Rs 7500</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Rs 7500 - Rs 8000</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Rs 8000 - Rs 8500</label>	
							</div>
						</div>
		        </section>
		       <section  class="sky-form">
					<h4>Brand Name</h4>
						<div class="row row1 scroll-pane">
							<div class="col col-4">
								<label class="checkbox"><input type="checkbox" name="checkbox" checked=""><i></i>John Jacobs</label>
							</div>
							<div class="col col-4">
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Tag Heuer</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Lee Cooper</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Mikli</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>S Oliver</label>
								<label class="checkbox"><input type="checkbox" name="checkbox" ><i></i>Hackett</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Killer</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>IDEE</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Vogue</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Gunnar</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Accu Reader</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>CAT</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Excellent</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Feelgood</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Odysey</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Animal</label>	
							</div>
						</div>
		       </section>
		       <section  class="sky-form">
					<h4>Frame Shape</h4>
						<div class="row row1 scroll-pane">
							<div class="col col-4">
								<label class="checkbox"><input type="checkbox" name="checkbox" checked=""><i></i>Pilot</label>
							</div>
							<div class="col col-4">
								
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Rectangle</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Square</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Round</label>
								<label class="checkbox"><input type="checkbox" name="checkbox" ><i></i>Others</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Cat Eyes</label>
								<label class="checkbox"><input type="checkbox" name="checkbox" ><i></i>Wrap Around</label>
								
							</div>
						</div>
		       </section>
		       <section  class="sky-form">
					<h4>Frame Size</h4>
						<div class="row row1 scroll-pane">
							<div class="col col-4">
								<label class="checkbox"><input type="checkbox" name="checkbox" checked=""><i></i>Small</label>
							</div>
							<div class="col col-4">
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Medium</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Large</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Medium</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Large</label>
							</div>
						</div>
		       </section>
		       <section  class="sky-form">
					<h4>Frame Type</h4>
						<div class="row row1 scroll-pane">
							<div class="col col-4">
								<label class="checkbox"><input type="checkbox" name="checkbox" checked=""><i></i>Full Rim</label>
							</div>
							<div class="col col-4">
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Rim Less</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Half Rim</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Rim Less</label>
								<label class="checkbox"><input type="checkbox" name="checkbox"><i></i>Half Rim</label>
							</div>
						</div>
		       </section>
		       <section  class="sky-form">
					<h4>Colors</h4>
						<ul class="color-list">
							<li><a href="#"> <span class="color1"> </span><p class="red">Red</p></a></li>
							<li><a href="#"> <span class="color2"> </span><p class="red">Green</p></a></li>
							<li><a href="#"> <span class="color3"> </span><p class="red">Blue</p></a></li>
							<li><a href="#"> <span class="color4"> </span><p class="red">Yellow</p></a></li>
							<li><a href="#"> <span class="color5"> </span><p class="red">Violet</p></a></li>
							<li><a href="#"> <span class="color6"> </span><p class="red">Orange</p></a></li>
							<li><a href="#"> <span class="color7"> </span><p class="red">Gray</p></a></li>
					   </ul>
		       </section>
		      </div>
			<div class="clear"></div>
			</div>
		   </div>
		</div>